package com.wxproject.demo.Common.lang;


import lombok.Data;

import java.io.Serializable;

@Data
public class Result implements Serializable {
    private int code;
    private String message;
    private String time;
    private Object data;
    public static Result success(String message,String date){
        return Result.result1(message,date);
    }

    public static Result fail(String message){
        Result r = new Result();
        r.setMessage(message);
        return r;
    }

    public static Result fail(String msg,String date){
        return fail(400,msg,date);
    }



    public static Result fail(int code,String message,String date){
        Result r = new Result();
        r.setCode(code);
        r.setMessage(message);
        r.setTime(date);
        return r;
    }

    public static Result result(int code,String message,Object data,String date){
        Result r = new Result();
        r.setCode(code);
        r.setMessage(message);
        r.setData(data);
        r.setTime(date);
        return r;
    }
    public static Result result1(String message,String date){
        Result r = new Result();
        r.setCode(200);
        r.setMessage(message);
        r.setTime(date);
        return r;
    }
    public static Result result2(String message,Object data,String date){
        Result r = new Result();
        r.setCode(200);
        r.setMessage(message);
        r.setData(data);
        r.setTime(date);
        return r;
    }
}
